package ch.unisi.inf.pfii.teamwhite.risk.sound;

/**
 * 
 * @author Matteo Bellan: bellanm@lu.unisi.ch
 * @author Andrea Michelotti: micheloa@lu.unisi.ch
 * @author Ranganathan Ramasubramanian: ramasubr@lu.unisi.ch
 * 
 */

import java.applet.AudioClip;
import java.net.URL;

public final class SoundEngine {

	public SoundEngine(final String fileName, final boolean soundIsEnabled, final boolean loop) {
		if(soundIsEnabled){
			URL url = getClass().getResource("audio/" + fileName);
			AudioClip clip = java.applet.Applet.newAudioClip(url);	
			if(loop) {
				clip.loop();
			} else {
				clip.play();
			}
		}
	}
}